package com.tarena.ebank.biz.entity;

public class Account {
	private Long oid; // 这个数可能比较大，用long

	private String acctNo; // 帐号

	private double bal; // 余额

	// 关联属性.
	private User owner;

	public Account() {
		super();
	}

	public Account(String acctNo, double bal) {
		super();
		this.oid = oid;
		this.acctNo = acctNo;
		this.bal = bal;
	}

	public String getAcctNo() {
		return acctNo;
	}

	public void setAcctNo(String acctNo) {
		this.acctNo = acctNo;
	}

	public double getBal() {
		return bal;
	}

	public void setBal(double bal) {
		this.bal = bal;
	}

	public Long getOid() {
		return oid;
	}

	public void setOid(Long oid) {
		this.oid = oid;
	}

	public void deposite(double amount) {
		bal += amount;
	}

	public static void main(String[] args) {
	}

	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((acctNo == null) ? 0 : acctNo.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Account other = (Account) obj;
		if (acctNo == null) {
			if (other.acctNo != null)
				return false;
		} else if (!acctNo.equals(other.acctNo))
			return false;
		return true;
	}

}
